package vn.edu.saigontech.ncms.model.system;

import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;

@Entity
@DiscriminatorValue("percent_discount")
@SuppressWarnings("serial")
public class ReceiptPercentDiscountItem extends ReceiptAbstractDiscountItem {
	
	@Column(name = "percent")
	private Double percent;
	
	@Override
	public String getDescription() {
		return this.name + " (" + this.getValueDescription() + ")";
	}
	
	@Override
	public String getValueDescription() {
		long lPercent = Math.round(this.percent * 100);
		return "" + lPercent + "%";
	}
	
	public long getPercentValue() {
		long lPercent = Math.round(this.percent * 100);
		return lPercent;
	}

	public Double getPercent() {
		return percent;
	}

	public void setPercent(Double percent) {
		this.percent = percent;
	}
}